﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace Puddy.ViewModels
{
    public class RingToneViewModel : INotifyPropertyChanged
    {
        public RingToneViewModel()
        {

        }

        public RingToneViewModel(String _name, String _path, bool isSelected)
        {
            Name = _name;
            Path = _path;
            IsSelected = isSelected;
        }


        String name;

        public String Name
        {
            get { return name; }
            set {
                if (name != value)
                {
                    name = value;
                    NotifyPropertyChanged("Name");
                }
            }
        }

        String path;

        public String Path
        {
            get { return path; }
            set {
                if (path != value)
                {
                    path = value;
                    NotifyPropertyChanged("Path");
                }
            }
        }

        bool isSelected;

        public bool IsSelected
        {
            get {
                return isSelected;
            }
            set {
                isSelected = value;
                NotifyPropertyChanged("IsShow");
                
            }
        }

        Visibility isShow;

        public Visibility IsShow
        {
            get
            {
                if (IsSelected)
                    isShow = Visibility.Visible;
                else
                    isShow = Visibility.Collapsed;
                return isShow;
            }
            set
            {
                NotifyPropertyChanged("IsShow");
                isShow = value;
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
